home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 223 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  58 lines

  1. Newsgroups: comp.lang.c
  2. Path: newshub.ariel.cs.yorku.ca!cs911319
  3. From: cs911319@ariel.cs.yorku.ca (STEPHEN HOI CHI KONG)
  4. Subject: Re: SYSTEM CALL RESULT
  5. X-Nntp-Posting-Host: red
  6. Message-ID: <DKLvt9.Jz@ariel.cs.yorku.ca>
  7. Sender: news@ariel.cs.yorku.ca (*)
  8. Organization: York University, Dept. of Computer Science
  9. References: <4cbn2i$env@bisance.citi2.fr> <820609309snz@intellic.demon.co.uk>
  10. Date: Wed, 3 Jan 1996 12:53:33 GMT
  11.  
  12. In article <820609309snz@intellic.demon.co.uk> truemanc@intellic.demon.co.uk writes:
  13. >In article <4cbn2i$env@bisance.citi2.fr>
  14. >           labed@math-info.univ-paris5.fr "A.Labed" writes:
  15. >
  16. >>
  17. >>Hi,
  18. >>
  19. >>Is there a way to get the result of a
  20. >>system call within a C program. 
  21. >>example :
  22. >
  23. >
  24. >The exit value of a process is returned by the system call. Therefore
  25. >if you wrote a small script which computed the line count of the
  26. >current list of processes and then exited with this value you could
  27. >pick it up as the return value of the system call.
  28. >
  29. >
  30. >
  31. >            - Chris
  32. >
  33. >-============================================================================-
  34. >IntelliCorp Applications Consultant / E-mail: truemanc@intellic.demon.co.uk
  35. >LiveModel and PowerModel are part   / CServe: 100255,701
  36. >of IntelliCorp's MODELWORKS        / Tel   : +44 (0)1344 305305
  37. >application development suite.      / Fax   : +44 (0)1344 305100
  38. >-============================================================================-
  39.  
  40.     I believe you have a more direct approach.
  41. try
  42. %man popen
  43.  
  44.     This system call redirect all stdout from external command into
  45. user buffer (char buf[]). Good Luck.
  46.  
  47.                         Zollen
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.